/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package polloBeta;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import javax.swing.JComponent;

/**
 *
 * @author arturo
 */
public class Lienzo extends JComponent{

    ArrayList<Point> puntos = new ArrayList<Point>();

    public Lienzo() {

        setPreferredSize(new Dimension(300, 500));
        setFocusable(true);
        requestFocus();

        addMouseListener(new MouseAdapter() {

            @Override
            public void mousePressed(MouseEvent e) {

                puntos.add(e.getPoint());
                repaint();


            }



        });
    }

    @Override
        public  void paint(Graphics g){

                for (Point point : puntos) {

                    g.setColor(Color.red);
                    g.fillOval(point.x, point.y, 5, 5);

               }

        }





    }



